﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication
{
    public class BasePage : System.Web.UI.Page
    {
        protected Model.UserInfo oUser;
        public string version;
        public BasePage()
        {
            this.Page.Load += new EventHandler(Page_Load);
        }

        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                version = "20150722"; //用于对页面引用的js、css进行发布版本控制
                //用户信息Session是否已经建立
                if (Context.Session["User"] != null)
                {
                    oUser = (Model.UserInfo)Context.Session["User"];
                }
                else
                {
                    Server.Transfer("~/TimeOut.aspx?message=timeout");
                }

                if (Request.UrlReferrer == null)
                {
                    if (!Request.Url.ToString().Contains("Main.aspx"))
                        Server.Transfer("~/TimeOut.aspx?message=noright", false);
                }
            }
            catch
            {
                Response.Redirect("~/TimeOut.aspx?message=timeout");
            }
        }
    }
}